package com.kotlin.zds.wigdet

import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.LinearLayout
import com.kotlin.zds.R
import com.kotlin.zds.databinding.TabwidgetItemBinding

/**
 * Author: zds
 * Date: 2022/6/11 12:40
 * Description:
 * Version: v1.0
 */
class TabWidgetItem (context: Context?, attrs: AttributeSet?) : LinearLayout(context, attrs) {
    init {
        val mBinding= TabwidgetItemBinding.inflate(LayoutInflater.from(context),this,true)
        val array = context?.obtainStyledAttributes(attrs, R.styleable.tab_item)?.apply {
            var tabText=getString(R.styleable.tab_item_ct_text)
            var icon=getDrawable(R.styleable.tab_item_ct_icon)
            mBinding.title.text=tabText
            mBinding.icon.setImageDrawable(icon)
        }
        array?.recycle()
    }
}